/*
桥接模式
*/
package Bridage

import (
	"fmt"
	"reflect"
)

type Draw interface {
	DrawCircle(radius, x, y int)
}

type RedCircle struct {
}

func (rc *RedCircle) DrawCircle(radius, x, y int) {
	fmt.Println("type, radius, x, y", reflect.TypeOf(rc), radius, x, y)
}

type YellowCircle struct {
}

func (yc *YellowCircle) DrawCircle(radius, x, y int) {
	fmt.Println("type, radius, x, y", reflect.TypeOf(yc), radius, x, y)
}

type Shape struct {
	draw Draw
}

func (s *Shape) Shape(d Draw) {
	s.draw = d
}

type Circle struct {
	shape  Shape
	x      int
	y      int
	radius int
}

func (c *Circle) Construct(x, y, radius int, draw Draw) {
	c.x = x
	c.y = y
	c.radius = radius
	c.shape.Shape(draw)
}

func (c *Circle) Draw() {
	c.shape.draw.DrawCircle(c.radius, c.x, c.y)
}
